import React, { useRef, useEffect, forwardRef } from 'react'
import { useGLTF, useAnimations } from '@react-three/drei'

const CoalChute = forwardRef((props, ref) => {
  const { nodes, materials, animations } = useGLTF('/models/coalChute.glb')
  const { actions } = useAnimations(animations, ref)
  useEffect(() => {
    for (const k in actions) {
      actions[k].play()
    }
  }, [actions]);
  return (
    <group visible={false} ref={ref} scale={0.001} dispose={null} >
      <group scale={0.025} position={[-2.3, 0, 0]}>
        <mesh geometry={nodes.平面001.geometry} material={materials['Material.007']} position={[202.1082, 15.541798, 3.349787]} scale={[3.100231, 26.228195, 22.312819]} />
        <mesh geometry={nodes.柱体001.geometry} material={materials.PaletteMaterial001} position={[249.187607, -9.25998, -39.682877]} rotation={[Math.PI / 2, -0.006654, Math.PI]} scale={[11.350997, 7.08042, 11.350997]} />
        <mesh geometry={nodes.柱体005.geometry} material={materials.PaletteMaterial002} position={[177.084839, -9.647853, -39.697556]} rotation={[0, 0, -Math.PI / 2]} scale={[8.123865, -16.665274, -8.123865]} />
        <instancedMesh args={[nodes.立方体002.geometry, materials.PaletteMaterial001, 5]} instanceMatrix={nodes.立方体002.instanceMatrix} />
        <instancedMesh args={[nodes.平面001_1.geometry, materials['Material.007'], 10]} instanceMatrix={nodes.平面001_1.instanceMatrix} />
        <instancedMesh args={[nodes.立方体011.geometry, materials.PaletteMaterial001, 5]} instanceMatrix={nodes.立方体011.instanceMatrix} />
        <instancedMesh args={[nodes.立方体012.geometry, materials.PaletteMaterial001, 5]} instanceMatrix={nodes.立方体012.instanceMatrix} />
        <instancedMesh args={[nodes.立方体013.geometry, materials.PaletteMaterial001, 5]} instanceMatrix={nodes.立方体013.instanceMatrix} />
        <instancedMesh args={[nodes.柱体006.geometry, materials.PaletteMaterial001, 26]} instanceMatrix={nodes.柱体006.instanceMatrix} />
        <instancedMesh args={[nodes.柱体006_1.geometry, materials.PaletteMaterial001, 26]} instanceMatrix={nodes.柱体006_1.instanceMatrix} />
      </group>
    </group>
  )
})

useGLTF.preload('/models/coalChute.glb')

export default CoalChute;
